<template>
	<view class="list">
		<view class="con">
			<view class="top">
				<view class="top-title" @click="gotoOrder">
					<text>{{listData.title}}</text>
				</view>
				<view class="top-more" v-if="listData.isMore" @click="gotoOrder">
					<view class="text">
						<text>查看全部订单</text>
					</view>
					<view class="img">
						<image :src="moreImg"></image>
					</view>
				</view>
			</view>
			<view class="bottom">
				<view @click="gotoItemPage(item)" class="box" v-for="(item,index) in listData.list" :key="index">
					<view class="img">
						<image :src="item.img"></image>
					</view>
					<view class="text">
						<text>{{item.name}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['listData'],
		data() {
			return {
				moreImg: require('@/static/img/common/goMore_1.svg')
			}
		},
		methods: {
			gotoItemPage(item) {
				this.$isLoginByVisitor()
				if(!uni.getStorageSync('isVisitorLogin')){
					return
				}
				//console.log(item)
				this.$emit('gotoItemPage', item)
				//console.log(item)
			},
			gotoOrder() {
				this.$isLoginByVisitor()
				if(!uni.getStorageSync('isVisitorLogin')){
					return
				}
				this.$emit('gotoOrder')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		width: 100%;
		margin: 30rpx 0;

		.con {
			width: 90%;
			margin-left: 3%;
			border-radius: 30rpx;
			background: #fff;
			padding: 2%;

			.top {
				display: flex;
				justify-content: space-between;

				.top-title {
					font-size: 36rpx;
					font-weight: 700;
					color: rgba(0, 0, 0, 1);
				}

				.top-more {
					display: flex;

					.text {
						font-size: 24rpx;
						font-weight: 400;
						color: rgba(166, 166, 166, 1);
					}

					.img {
						image {
							width: 40rpx;
							height: 40rpx;
						}
					}
				}
			}

			.bottom {
				margin-top: 20rpx;
				margin-bottom: 20rpx;
				display: flex;
				flex-wrap: wrap;

				.box {
					width: 25%;
					margin-bottom: 20rpx;
					height: 100rpx;

					.img {
						text-align: center;

						image {
							width: 56rpx;
							height: 56rpx;
						}
					}

					.text {
						text-align: center;
						font-size: 28rpx;
						font-weight: 400;
						color: rgba(128, 128, 128, 1);
					}
				}
			}
		}
	}
</style>
